/*
 * Copyright (C) 2024-2025 Deepin Technology Co., Ltd.
 *
 * Author:     zhangbingyi <zhangbingyi@uniontech.com>
 *
 * Maintainer: zhangbingyi <zhangbingyi@uniontech.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef SECURITYTOOLSWIDGET_H
#define SECURITYTOOLSWIDGET_H

#include "common.h"
#include "widgets/hframe1.h"

#include <QModelIndex>
#include <QWidget>
#include <QToolButton>
#include <QPushButton>
//#include <DIconButton>
//#include <DGuiApplicationHelper>

// 病毒查杀类型
enum SecurityClickType {
    DataUsageItem, //  流量详情
    StartupItem, //  自启动项
    NetControlItem, //  联网应用
    UsbControl, // USB管控
    LoginSafety, //登录安全
    SystemSafeLevel, // 系统安全等级
    FileTrustProtection, // 可信保护
    ExeFilesProtection, // 执行保护
    PeripheralsManagement // 外设管控
};

class QStandardItemModel;
class SecurityToolsModel;
class SystemRebootDialog;

class SecurityToolsWidget : public QWidget
{
    Q_OBJECT

public:
    explicit SecurityToolsWidget(SecurityToolsModel *model, QWidget *parent = nullptr);
    ~SecurityToolsWidget();

private:
    // 初始化界面
    void initUI();

    QWidget *getToolWidget(const QString &sAccessName, const QString &sTitle, const QString &sTip, const QString &sIcon, int nType);

private Q_SLOTS:
    // 流量/自启动/联网应用点击槽
    void doSecurityItemClicked(int nIndex);
    //设置因主题改变图标
    void changeThemeType(ColorType themeType);

    void onDialogClose();
    void enableRebootFlag();
Q_SIGNALS:
    void notifyShowStartupWidget();
    void notifyShowNetControlWidget();
    void notifyShowDataUsageWidget();
    void notifyShowUsbControlWidget();
    void notifyShowLoginSafetyWidget();
    void notifyShowSecurityLevelWidget();
    void notifyShowTrustedProtectionWidget();
    void notifyShowExeFilesProtectionWidget();
    void notifyShowPeripheralsManagementWidget();

private:
    SecurityToolsModel *m_model;
    QFrame *m_scrollAreaWidgetContents;

    SystemRebootDialog *m_systemRebootDialog;
    bool m_rebootFlag;
};

#endif // SECURITYTOOLSWIDGET_H
